﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>NewPerson</title>
    <link href="~/Resources/mainFrame/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="~/Resources/mainFrame/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="~/Resources/mainFrame/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Resources/mainFrame/css/animate.min.css" rel="stylesheet">
    <link href="~/Resources/mainFrame/css/style.min862f.css" rel="stylesheet">

    <!--treeview需要的css-->
    <link href="~/Resources/mainFrame/css/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">

    <!--日期需要的css和js-->
    <link href="~/Resources/mainFrame/css/plugins/datapicker/datepicker3.css" rel="stylesheet" />
    <link href="~/Resources/mainFrame/js/plugins/zTree3/css/metroStyle/zTreeStyle.css" rel="stylesheet" />
    <link href="~/Resources/css/BootTableHelp/pagination.css" rel="stylesheet" />
</head>
<body class="panel-body">
    <div class="row">
        <div id="divTree" class="col-sm-2" style="overflow:auto; border-right:1px solid gray;">
            <input type="text" name="searchArea" id="searchArea" style="width:100%;height:30px;" placeholder="请输入项目名称" />
            <select id="seSheng" style="width:100%;height:30px;"></select>
            <select id="seShi" style="width:100%;height:30px;"></select>
            <div id="divtreeDetail" style="overflow-y:auto; overflow-x:hidden;">
                <ul id="testTree" style="padding:0px;" class="ztree"></ul>
            </div>
        </div>
        <div class="col-sm-10">
            <div class="example">
                <table id="TableFromData" data-mobile-responsive="true"></table>
            </div>
        </div>
    </div>
    <div id="table-tool" class="row">
        <input type="hidden" id="JianDie" value="@ViewBag.UnitID" />
        <div class="col-sm-12" style="padding:0;">
            <div class="input-group">
                <span class="input-group-btn">
                    @{
                        List<string> folderList = (List<string>)ViewBag.elementList;
                        if (folderList.Contains("btnSearch"))
                        {
                            <input type="text" id="txtSearchName" style="width:150px;" class="form-control" placeholder="人员姓名">
                            <select id="btnTeam" name="btnTeam" class="form-control" style="width:120px;">
                            </select>
                            <select id="btnPersonType" name="btnPersonType" class="form-control" style="width:120px;">
                                <option value="人员选择">人员选择</option>
                                <option value="所有人员">所有人员</option>
                                <option value="在职人员">在职人员</option>
                                <option value="离职人员">离职人员</option>
                            </select>
                            <button type="button" id="btnSearch" class="btn btn-primary">
                                <i class="glyphicon glyphicon-search"></i>
                                查询
                            </button>
                        }
                        if (folderList.Contains("AddPerson"))
                        {
                            <button type="button" id="AddPerson" class="btn btn-primary" style="margin-left: 2px;">
                                <i class="glyphicon glyphicon-plus"></i>
                                新增
                            </button>
                        }
                        if (folderList.Contains("EditPerson"))
                        {
                            <button type="button" id="EditPerson" class="btn btn-primary" style="margin-left: 2px;">
                                <i class="glyphicon glyphicon-pencil"></i>
                                编辑
                            </button>
                        }
                        if (folderList.Contains("DeletePerson"))
                        {
                            <button type="button" id="DeletePerson" class="btn btn-danger" style="margin-left: 2px;">
                                <i class="glyphicon glyphicon-remove"></i>
                                删除
                            </button>
                        }
                        if (folderList.Contains("btnMove"))
                        {
                            <button type="button" id="btnMove" class="btn btn-primary" style="margin-left: 2px;">
                                <i class="glyphicon glyphicon-retweet"></i>
                                操作
                            </button>
                        }
                        if (folderList.Contains("btnRetire"))
                        {
                            <button type="button" id="btnRetire" class="btn btn-primary" style="margin-left: 2px;">
                                <i class="glyphicon glyphicon-minus-sign"></i>
                                办理离职
                            </button>
                        }
                        if (folderList.Contains("btnExcel"))
                        {
                            <a href="javascript:void(0);" onclick="SetHref();" id="btnExcel" target="_blank" class="btn btn-primary" style="margin-left: 2px;">
                                <i class="glyphicon glyphicon-save"></i>
                                导出Excel
                            </a>
                        }
                    }
                </span>
            </div>
        </div>
    </div>

    <div id="divMove" style="display:none; margin:0px; padding:0;" class="col-sm-12">
        <input type="hidden" name="moveJianDie" id="moveJianDie" value="" />
        <div class="col-sm-8" style="padding:0; margin:0px;">
            <table id="move_table" data-mobile-responsive="true"></table>
        </div>
        <div id="divMoveTree" class="col-sm-4" style="padding:0;margin:0px;overflow:auto; margin:0;">
            <div id="move_treeview"></div>
        </div>
    </div>

    <div id="divRetire" style="display:none; margin:0px; padding:0;" class="col-sm-12">
        <div class="col-sm-12" style="padding:0; margin:0px;">
            <table id="retire_table" data-mobile-responsive="true"></table>
        </div>
    </div>
    <div id="retire_tool">
        <input type="text" id="retire_time" style="width:200px;" class="form-control" placeholder="离职时间">
    </div>

    @Scripts.Render("~/bundles/mainScript")
    @Scripts.Render("~/bundles/bootstrap-table")
    @Scripts.Render("~/bundles/TreeViewItem")
    @Scripts.Render("~/bundles/z-tree")
    <!--引入bootstrap-table-help.JS文件。该文件包含一个table基类-->
    <script src="~/Scripts/bootstrap-table-help.js"></script>
    <script src="~/Scripts/bootstrap-tree-help.js"></script>
    <script src="~/Scripts/url-help.js"></script>
    <script src="~/Resources/myScript/Person/NewPerson.js"></script>
    <script src="~/Resources/layer-3.0.1/layer.js"></script>
    <script src="~/Resources/mainFrame/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script>
        $(function () {
            $("#divTree").height($.GetBodyHeight());
            $("#divtreeDetail").height($.GetBodyHeight()-90);
            Lutai.Load("seSheng", "seShi", "searchArea", "testTree", 1, treeClick);
            @*treeHelp.BindTree("treeview",@Html.Raw(ViewBag.TreeJson),treeClick);*@

            function treeClick (event, treeId, o){
                var unit_id = $("#JianDie").val();
                if(unit_id != o.unit_id)//换单位重置所属队伍
                    $("#btnTeam").val("");
                $("#JianDie").val(o.unit_id);
                tableHelp.refresh(table);
                SelectBox.TheTeam();
            }

            $("#divMoveTree").height(300);
            treeHelp.BindTree("move_treeview",@Html.Raw(ViewBag.TreeJson),treeMoveClick);
            function treeMoveClick (o){
                $("#moveJianDie").val(o.UnitID);
            }

            $("#retire_time").datepicker({
                show: true,
                format: "yyyy-mm-dd",
                language: "zh-CN",
                weekStart: 1,
                autoclose: true,
                orientation: "right",
                todayBtn: "linked"
            })
        });

        function SetHref(){
            var da = document.getElementById("btnExcel");
            da.href = "../Person/Excel?UnitID=" + $("#JianDie").val();
        }

    </script>
</body>
</html>
